@using System.Text
@using Newtonsoft.Json.Linq

<ul class="layui-nav layui-nav-tree" lay-filter="test">
    @{
        string filepath = Server.MapPath("~/json/nav.json");
        string jsonString = File.ReadAllText(filepath, Encoding.Default);
        JArray ja = JArray.Parse(jsonString);
        for (int i = 0; i < ja.Count; i++)
        {
            JObject jo = JObject.Parse(ja[i].ToString());
            if ((bool) jo["isDefault"])
            {
                <li class="layui-nav-item layui-nav-itemed">
                    <a lay-id="@jo["id"].ToString()" class="" href="javascript:;">
                        <i class="layui-icon layui-icon-@jo["icon"].ToString()"></i> <cite>@jo["title"].ToString()</cite>
                    </a>
                    <dl class="layui-nav-child">
                        @{
                            JArray jar = JArray.Parse(jo["children"].ToString());
                            for (int j = 0; j < jar.Count; j++)
                            {
                                JObject job = JObject.Parse(jar[j].ToString());
                                if ((bool) job["isDefault"])
                                {
                                    <dd class="layui-this">
                                        <a lay-id="@job["id"].ToString()" href="javascript:;" lay-href="@job["url"].ToString()">@job["title"].ToString()</a>
                                    </dd>
                                }
                                else
                                {
                                    <dd>
                                        <a lay-id="@job["id"].ToString()" href="javascript:;" lay-href="@job["url"].ToString()">@job["title"].ToString()</a>
                                    </dd>
                                }
                            }
                        }
                    </dl>
                </li>
            }
            else
            {
                <li class="layui-nav-item">
                    <a lay-id="@jo["id"].ToString()" class="" href="javascript:;">
                        <i class="layui-icon layui-icon-@jo["icon"].ToString()"></i> <cite>@jo["title"].ToString()</cite>
                    </a>
                    <dl class="layui-nav-child">
                        @{
                            JArray jar = JArray.Parse(jo["children"].ToString());
                            for (int j = 0; j < jar.Count; j++)
                            {
                                JObject job = JObject.Parse(jar[j].ToString());
                                <dd>
                                    <a lay-id="@job["id"].ToString()" href="javascript:;" lay-href="@job["url"].ToString()">@job["title"].ToString()</a>
                                </dd>
                            }
                        }
                    </dl>
                </li>
            }
            Console.WriteLine(jo["title"].ToString());
            Console.WriteLine(jo["icon"].ToString());
        }
    }
</ul>